package com.sc.nft.mapper;

import com.sc.nft.entity.PayOrder;
import com.sc.nft.entity.PayOrderItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.enums.PayTypeEnum;
import com.sc.nft.enums.SecondPayOrderItemTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 支付订单子项表(sc_pay_order_item)数据Mapper
 *
 * @author zxy
 * @since 2023-06-14 17:38:47
 * @description 支付订单子项表
*/
@Mapper
public interface PayOrderItemMapper extends BaseMapper<PayOrderItem> {

    @Select("SELECT po.* from sc_pay_order_item poi LEFT JOIN  sc_pay_order po on po.id=poi.pay_order_id " +
            "WHERE poi.order_id=#{orderId} AND poi.order_type=#{orderItemType} AND po.order_type=#{payOrderType} and po.`status`=2 ")
    public PayOrder getByOrderIdAndOrderType(@Param("orderId")Long orderId ,@Param("orderItemType") SecondPayOrderItemTypeEnum payOrderItemTypeEnum,
                                             @Param("payOrderType")PayTypeEnum payTypeEnum);



}
